# encoding: UTF-8
require 'fox16'
require_relative 'talk'
include Fox

theApp = FXApp.new

theMainWindow = FXMainWindow.new(theApp,"hello" , icon=nil, miniIcon=nil, opts=DECOR_ALL, x=200, y=200, width=500, height=500, padLeft=0, padRight=0, padTop=0, padBottom=0, hSpacing=0, vSpacing=0)

wordsroom = FXText.new(theMainWindow,
	:opts => FRAME_THICK|TEXT_WORDWRAP|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT|LAYOUT_FIX_X|LAYOUT_FIX_Y, :width => 400, :height => 300, :x => 40, :y => 10
					)
 wordsroom.backColor=FXRGB(100, 100, 100)
 wordsroom.text="拉开距离快乐"

mywords = FXText.new(theMainWindow,
	:opts => FRAME_THICK|TEXT_WORDWRAP|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT|LAYOUT_FIX_X|LAYOUT_FIX_Y, :width => 400, :height => 100, :x => 40, :y => 320
					)
mywords.backColor=FXRGB(100, 100, 100)

exitButton = FXButton.new(theMainWindow, "关闭", icon=nil, target=nil, selector=0,
						:opts => FRAME_RAISED|FRAME_THICK|LAYOUT_FIX_X|LAYOUT_FIX_Y|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, :width => 100, :height => 50, :x => 200, :y => 430
						)
exitButton.connect(SEL_COMMAND) { exit }

sentButton = FXButton.new(theMainWindow, "发送", icon=nil, target=nil, selector=0,
						:opts => FRAME_RAISED|FRAME_THICK|LAYOUT_FIX_X|LAYOUT_FIX_Y|LAYOUT_FIX_WIDTH|LAYOUT_FIX_HEIGHT, :width => 100, :height => 50, :x => 300, :y => 430
						)
sentButton.connect(SEL_COMMAND) {

	hear=mywords.text
	mywords.text=""
	str="\n"+hear
	if hear != ""
		wordsroom.appendText(str)
	else
		
	end
	
}



FXToolTip.new(theApp)

theApp.create

theMainWindow.show

theApp.run

